<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <!-- 引入样式 -->
    <link rel="stylesheet" href="../plugins/elementui/index.css">
    <link rel="stylesheet" href="../plugins/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="../css/style.css">
    <!-- 引入组件库 -->
    <script type="text/javascript" src="../js/jquery.min.js"></script>
    <script src="../js/vue.js"></script>
    <script src="../plugins/elementui/index.js"></script>
    <script src="../js/axios-0.18.0.js"></script>
</head>
<body>

<div id="div">


    <el-tree
            :data="datas"
            show-checkbox
            node-key="id"
            :default-expanded-keys="values"
            :default-checked-keys="[]"
            :props="defaultProps">
    </el-tree>
</div>


<script>
    new Vue({
        el:"#div",
        data:{
            datas:[],
            values:[],
            defaultProps: {
                children: 'children',
                label: 'label'
            }
        },

        created(){
            axios.get("/user/findMenu.do").then((data)=>{
                if(data.data.flag){
                    this.datas = data.data.data;
                    axios.get("/user/getItems.do").then(data=>{
                        if(data.data.flag){
                             this.values = data.data.data
                        }
                    })
                }else {
                    this.$message.error("错误")
                }

            })
        }




    })
</script>

</body>
</html>